local function Fn()
    local Fx = Class()


    function Fx:Init(NPC_BASE_LIB)
        ---------------------------------------------------------------------------------------------------------------------------


        -- if NPC_BASE_LIB.inst == nil or not NPC_BASE_LIB.inst:HasTag("player") then
        --     return
        -- end
        function NPC_BASE_LIB:Show_Chat_Bubble(cmd_table)
                -- _table = {
                --      image = "moonrockseed" , -- prefab name
                --      num = 0 ,           number, 0~99
                --      height = 2.5,
                --      time = 30
                --      sound_off = nil   ----- true 的时候 关闭声音
                --      monster = nil     ----- 怪物贴图名字
                -- }

            ----- 取消超时消失任务
            if self.tempData.The_Chat_Bubble_Time_Out_Task then
                self.tempData.The_Chat_Bubble_Time_Out_Task:Cancel()
                self.tempData.The_Chat_Bubble_Time_Out_Task = nil
            end


            if cmd_table and ( cmd_table.image or cmd_table.monster )  then
                if self.tempData.The_Chat_Bubble == nil then
                    local tempBubble = self.inst:SpawnChild("npc_fx_chat_bubble")
                    tempBubble.Ready = true
                    self.tempData.The_Chat_Bubble = tempBubble
                end
                self.tempData.The_Chat_Bubble:PushEvent("Show",cmd_table)

                local height = cmd_table.height or 3
                self.tempData.The_Chat_Bubble.Transform:SetPosition(0,height,0)
                if cmd_table.sound_off ~= true then
                    self:Say("  ")
                end

                if cmd_table.time and type(cmd_table.time) == "number" then
                    self.tempData.The_Chat_Bubble_Time_Out_Task = self.inst:DoTaskInTime(cmd_table.time,function(inst)
                        inst.components.npc_base_lib:Hide_Chat_Bubble()
                    end)
                end

            end
        end

        function NPC_BASE_LIB:Hide_Chat_Bubble()
            if self.tempData.The_Chat_Bubble then
                self.tempData.The_Chat_Bubble:Remove()
                self.tempData.The_Chat_Bubble = nil
            end
        end
        ---------------------------------------------------------------------------------------------------------------------------
        function NPC_BASE_LIB:Show_Trade_Bubble(cmd_table)
            -- _table = {
            --     wanted_image = "moonrockseed" , -- prefab name
            --     wanted_num = 10,        0~99
            --     ret_image = "log",
            --     ret_num = 1,
            --     pause = nil
            --     height = 3,
            --      sound_off = nil   ----- true 的时候 关闭声音
            -- }
            local tempData = self.tempData
            if cmd_table == nil or cmd_table.wanted_image == nil or cmd_table.wanted_num == nil or cmd_table.ret_image == nil or cmd_table.ret_num == nil then
                return
            end
            if tempData.The_Trade_Bubble == nil then
                tempData.The_Trade_Bubble = self.inst:SpawnChild("npc_fx_trade_bubble")
            end
            tempData.The_Trade_Bubble:PushEvent("Show",cmd_table)

            local height = cmd_table.height or 3
            tempData.The_Trade_Bubble.Transform:SetPosition(0,height,0)
            if cmd_table.sound_off ~= true then
                self:Say("  ")
            end
        end

        function NPC_BASE_LIB:Hide_Trade_Bubble()
            if self.tempData.The_Trade_Bubble then
                self.tempData.The_Trade_Bubble:Remove()
                self.tempData.The_Trade_Bubble = nil
            end
        end
        
        ---------------------------------------------------------------------------------------------------------------------------
    end

    return Fx
end

return Fn